<template>
    <div>
    <div class="top" v-for="(book,id) in books" :key="id">
      
      <div class="shang">
        <div class="tou">
          <span class="iconfont icon-jingcha"></span>
        </div>
        <div class="you">
        <h3>{{book.wenben1}}</h3>
        <p><a href="#">{{book.wenben2}}</a></p>
        </div>
      </div>

      <ul>
          <li>
              <span>{{book.shuzi1}}</span>
              <span>{{book.wenben3}}</span>
          </li>
          <li>|</li>
           <li>
              <span>{{book.shuzi2}}</span>
              <span>{{book.wenben4}}</span>
          </li>
      </ul>
    </div>
    </div>
</template>

<script>
export default {
  name: "App",
  components: {},
  data() {
    return {
      books: [],
    };
  },
  created() {
    let xhr = new XMLHttpRequest();
    xhr.open("get", "http://localhost:3000/wode");
    xhr.onreadystatechange = () => {
      if (xhr.readyState == 4 && xhr.status == 200) {
        console.log("xhr.responseText", xhr.responseText);
        this.books = JSON.parse(xhr.responseText);
      }
    };
    xhr.send();
  },
};
</script>

<style scoped>
.top {
  height: 10rem;
  width: 100%;
  background: #4259f4;
  border-end-start-radius: 45%;
  border-end-end-radius: 45%;
}

.top .shang {
  height: 0.8rem;
  width: 100%;
  /* background: brown; */
  margin-top: 0.5rem;
  margin-left: 0.2rem;
  display: flex;
}

.top .shang .tou span{
  width: 3rem;
  height: 3rem;
  /* background: burlywood; */
  border-radius: 50%;
  font-size: 1.5rem;
  color:white;
}
.top .shang .you{
    margin-left: .2rem;
    margin-top: .1rem;
    letter-spacing: .02rem;
}

.top .shang .you h3{
    color: #fff;
    font-size: .18rem;
    font-weight: 500;
}

.top .shang .you a{
    color: #fff;
    font-size: .12rem;
    /* margin-top: 3rem; */
    position: relative;
   
}
.top ul{
    display: flex;
    width: 80%;
    height: .5rem;
    justify-content: space-between;
    margin: auto;
    color: #fff;
    margin-top: .1rem;
    position: relative;
    margin-top: 3rem;
}

.top ul li{
    display: flex;
    flex-direction: column;
    align-items: center;
}

.top ul li span:first-child{
    margin-bottom: .1rem;
}
</style>